<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import= "java.util.Iterator"%>
<%@ page import= "java.util.List"%>
<%@ page import= "dto.EmpleadoDTO"%>
<%@ page import= "dto.MesaDTO"%>
<%@ page import= "dto.ComandaDTO"%>
<%@ page import= "dto.ItemComandaDTO"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Comanda</title>
</head>
<body style="height: 369px; background-color: #72C050">

<%
	EmpleadoDTO emp = (EmpleadoDTO)request.getAttribute("empleado");
	ComandaDTO c = (ComandaDTO)request.getAttribute("comanda");
	boolean resp = (Boolean)request.getAttribute("resp");
	

%>

<%if(resp){ %>
	<table cellspacing="3" cellpadding="3" border="1" width="500" style="width: 1215px; background-color: #CEEEB9; border-bottom-style: double; border-top-style: double; border-left-style: double; border-right-style: double">
	<tr>
		<td colspan="4"><b>Comanda <%=" " + c.getNumero() %></b></td>
	</tr>
	<tr>
		<td style="width: 99px; "><b>Id Comanda</b></td>
		<td style="width: 164px; "><b>Plato</b></td>
		<td style="width: 157px; "><b>Cantidad</b></td>
		<td style="width: 163px; "><b>Estado</b></td>
	</tr>
<%
	ItemComandaDTO aux; 	
	List<ItemComandaDTO> items = c.getItems();
	
	if(items != null){
		for(Iterator<ItemComandaDTO> i = items.iterator(); i.hasNext();)
		{
			aux = i.next();
		
%>
	<tr>
		<td><%=aux.getId()%></td>
		<td><%=aux.getPlato().getNombre()%></td>
		<td><%=aux.getCantidad()%></td>
		<td><%=aux.getEstado()%></td>
	</tr>
	<% 		
	}
}%>
</table>

<div style="height: 45px; "></div>
<div style="height: 45px; "></div>

<table align ="center" style="background-color: #72C050; color: #FFFFFF; font-weight: bold">
	<tr>
	 <td colspan="2" align="center" style="color: Black; border-left-color: #000000; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000">
         <form action="MozoServlet?action=volverAbrirComanda" method ="post">
         		<input type ="hidden" name = "comanda" readonly ="readonly" value ="<%=c.getNumero()%>">
         		<input type ="hidden" name = "nombre" readonly ="readonly" value ="<%=emp.getNombre()%>">
	        	<input type ="hidden" name = "legajo" readonly ="readonly" value ="<%=emp.getLegajo()%>">
	        	<input type="submit" value="Volver" name="regresarr" style="font-family:; font-style: normal; font-weight: bold; width: 203px; height: 30px; background-color: #74B335">
        	</form>
        </td>
	</tr>
</table>

<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>

<table align ="center" style="background-color: #72C050; color: #FFFFFF; font-weight: bold">
	<tr>
		<td align ="center"><input type = "text" name = "nombre" readonly ="readonly" value ="<%=emp.getNombre()%>"></td>
		<td align ="center"><input type = "text" name = "legajo" readonly ="readonly" value ="<%=emp.getLegajo()%>"></td>
	</tr>
</table>

<%}else{ %>

<h1 align = "center">No se puede agregar el plato por falta de STOCK</h1>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>
<div style="height: 45px; "></div>

<table align ="center" style="background-color: #72C050; color: #FFFFFF; font-weight: bold">
	<tr>
	 <td colspan="2" align="center" style="color: Black; border-left-color: #000000; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000">
         <form action="MozoServlet?action=volverAbrirComanda" method ="post">
         		<input type ="hidden" name = "comanda" readonly ="readonly" value ="<%=c.getNumero()%>">
         		<input type ="hidden" name = "nombre" readonly ="readonly" value ="<%=emp.getNombre()%>">
	        	<input type ="hidden" name = "legajo" readonly ="readonly" value ="<%=emp.getLegajo()%>">
	        	<input type="submit" value="Volver" name="regresarr" style="font-family:; font-style: normal; font-weight: bold; width: 203px; height: 30px; background-color: #74B335">
        	</form>
        </td>
	</tr>
</table>

<div style="height: 45px; "></div>
<div style="height: 45px; "></div>

<table align ="center" style="background-color: #72C050; color: #FFFFFF; font-weight: bold">
	<tr>
		<td align ="center"><input type = "text" name = "nombre" readonly ="readonly" value ="<%=emp.getNombre()%>"></td>
		<td align ="center"><input type = "text" name = "legajo" readonly ="readonly" value ="<%=emp.getLegajo()%>"></td>
	</tr>
</table>
	

<%}%>

</body>
</html>